<?php
/**
 * Created by PhpStorm.
 * User: teddy
 * Date: 16-1-6
 * Time: 下午3:33
 */



/*数据库链接*/
$mysqli = new mysqli('192.168.2.191','root','pwd','APITEST');
/*Sql语句*/
$sql = "SELECT DATE(datetime) as day, sum(successCount) as success, sum(failCount) as fail FROM APITEST.TestJob where DATE_SUB(CURDATE(), INTERVAL 14 DAY) <= datetime GROUP BY DATE(datetime) order by day";
//$sql = "select * from APITEST.highcharts_php";
/*设置UTF8*/
$mysqli->query("set character set 'utf8'");
$mysqli->query("set names 'utf8'");
/*取数据*/
$results = $mysqli->query($sql);

/*把数据放在Array中*/
while($row = $results->fetch_assoc())
{
    echo $row['day'] . "\t" . $row['success'] . "\t" . $row['fail'] . "\n";
}


/*释放资源*/
$results->free();

/*关闭链接*/
$mysqli->close();